-- Class Sprite --
Game.Sprite = {}
Game.Sprite.Table = {}
function Game.Sprite.new (image, larg, haut, dest, anims, vitesses, screen, x, y, name, dir)
  local _spR = Sprite.new (image, larg, haut, dest)
  for i=1, table.getn(anims) do
    _spR:addAnimation (anims[i], vitesses[i])
  end
  local x2 = x+larg
  local y2 = y+haut
  Collisions.newObject (name, screen, x, y, x2, y2, "Sprite", _spR)
  Game.Sprite.Table[name] = {}
  Game.Sprite.Table[name].scr = screen
  Game.Sprite.Table[name].x = x
  Game.Sprite.Table[name].y = y
  Game.Sprite.Table[name].x2 = x2
  Game.Sprite.Table[name].y2 = y2
  Game.Sprite.Table[name].dir = dir
  Game.Sprite.Table[name].spr = _spR
  return Game.Sprite.Table[name].spr
end
function Game.Sprite.draw (name)
  Collisions.update (name, Game.Sprite.Table[name].x, Game.Sprite.Table[name].y, Game.Sprite.Table[name].x2, Game.Sprite.Table[name].y2)
  Game.Sprite.Table[name].spr:playAnimation(Game.Sprite.Table[name].scr, Game.Sprite.Table[name].x, Game.Sprite.Table[name].y, Game.Sprite.Table[name].dir)
end
function Game.Sprite.moveLeft (name, nbpix)
  Game.Sprite.Table[name].x = Game.Sprite.Table[name].x-nbpix
  Game.Sprite.Table[name].x2 = Game.Sprite.Table[name].x2-nbpix
  Game.Sprite.Table[name].dir = 4
end
function Game.Sprite.moveRight (name, nbpix)
  Game.Sprite.Table[name].x = Game.Sprite.Table[name].x+nbpix
  Game.Sprite.Table[name].x2 = Game.Sprite.Table[name].x2+nbpix
  Game.Sprite.Table[name].dir = 2
end
function Game.Sprite.moveUp (name, nbpix)
  Game.Sprite.Table[name].y = Game.Sprite.Table[name].y-nbpix
  Game.Sprite.Table[name].y2 = Game.Sprite.Table[name].y2-nbpix
  Game.Sprite.Table[name].dir = 1
end
function Game.Sprite.moveDown (name, nbpix)
  Game.Sprite.Table[name].y = Game.Sprite.Table[name].y+nbpix
  Game.Sprite.Table[name].y2 = Game.Sprite.Table[name].y2+nbpix
  Game.Sprite.Table[name].dir = 3
end
-- end Sprite --